﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using easyVal.Web.Demo.BL;
using easyVal.Web.Demo.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace easyVal.Test.Server
{
    [TestClass]
    public class ServerTests
    {
        [TestMethod]
        public void ServerTest( )
        {
            //
            Employee employee = new Employee();
            employee.Email = "Aasif@gmail.com";
            employee.DesiredSalary = 10000000;
            employee.FirstName = "Aasif";
            employee.PhoneNumber = "214-927-3895";

            // Warmup
            EmployeeBL.SaveEmployeeWithoutEasyval(employee);
            EmployeeBL.SaveEmployeeEasy(employee);

            //
            Stopwatch sw = new Stopwatch();
            const int _count = 10;
            sw.Reset();
            sw.Start();
            for (int i = 0; i < _count; i++)
            {
                EmployeeBL.SaveEmployeeWithoutEasyval(employee);
            }
            sw.Stop();
            Console.WriteLine("Elapsed no EasyVal: milliseconds: " + sw.ElapsedMilliseconds + ", ticks: " + sw.ElapsedTicks);

            sw.Reset();
            sw.Start();
            for (int i = 0; i < _count; i++)
            {
                EmployeeBL.SaveEmployeeEasy(employee);
            }
            sw.Stop();
            Console.WriteLine("Elapsed with EasyVal: milliseconds: " + sw.ElapsedMilliseconds + ", ticks: " + sw.ElapsedTicks);
        }


    }
}
